package com.topnav.mc.admin.entity.bean;

import com.topnav.mc.admin.entity.Device;
import com.topnav.mc.admin.entity.DeviceLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;

@Data
@Accessors(chain = true)
public class DeviceLogBean extends DeviceLog {

    private String deviceName;

    @ApiModelProperty(value="组织机构简称")
    private String shortName;
    @ApiModelProperty(value="组织机构路径")
    private String path;


    @ApiModelProperty(value="用户编号")
    private String userCode;
    @ApiModelProperty(value="用户姓名")
    private String userName;
    private String actionStr;
    private String locate;

    public String getActionStr(){
        if (this.getAction() == 0){
            return "downLine";
        }else if (this.getAction() == 1){
            return "upLine";
        }else{
            return "";
        }
    }

    public String getLocate(){
        if (!StringUtils.isEmpty(this.getLongitude()) && !StringUtils.isEmpty(this.getLatitude())){
            return this.getLongitude() + "," + this.getLatitude();
        }else{
            return "";
        }
    }

}
